home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / misc / zpoint_3_14.lha / zpoint-3.14 / Rexx / RexxHelp.zprx < prev    next >
Text File  |  1996-06-02  |  7KB  |  330 lines

  1. /*
  2.    RexxHelp.zprx 1.0 (31.5.96) by Jörg Strohmayer,
  3.    based upon
  4.  
  5.    TinyHelp.zp 2.0 (6.2.94) by Ueli Kaufmann
  6.    ARexx Skript für Zodiac's Point
  7.  
  8. Zweck:
  9. ------
  10.    Zeigt eine Uebersicht *aller* ARexx-Skripten
  11.    und bietet die Moeglichkeit, sie per Mausklick zu starten..
  12.  
  13.  
  14. Hinweis:
  15. --------
  16.  - benoetigt die apig.library v3.3 von fish 634.
  17.  
  18.  
  19. Installation:
  20. -------------
  21. Ins fkeys.zp einbinden mit folgender Zeile:
  22.   F10:ZP:Rexx/RexxHelp.zprx >NIL: %s
  23. */
  24.  
  25.  
  26. parse arg zpPort
  27. address value zpPort
  28.  
  29.  
  30. /* benoetigte Libraries laden */
  31. if(~show('l',"rexxsupport.library")) then
  32.    x = addlib("rexxsupport.library",0,-30,0)
  33.  
  34. if(~show('l',"apig.library")) then
  35.    x = addlib("apig.library",0,-30,0)
  36.  
  37.  
  38.  /* apig vorbereiten */
  39. call Set_APIG_Globals()
  40.  
  41.  
  42. screen       = LockPubScreen("ZPoint")      /* gonna put our window  */
  43.                                             /* upon ZPoint screen    */
  44.  
  45. scrvinfo    = GetVisualInfo(screen)        /* NewGadgets need this  */
  46.  
  47. scrfont     = GETVALUE(screen,40,4,'p')    /* NewGadgets need this  */
  48.                                            /* points to TextAttr    */
  49.  
  50. glist       = AllocVec(4,MEMF_CLEAR)       /* a pointer for context */
  51.  
  52. conxgad     = CreateContext(glist)
  53. prevGadget  = conxgad
  54.  
  55.  
  56. /* Adressen Listview-Gadget */
  57.  
  58. newgadx = MakeNewGadget(scrvinfo,scrfont,8,16,624,182,null(),
  59.           ,null(),1,null())
  60.  
  61. if newgadx == null() then
  62.    exit(0)
  63.  
  64. rxList = build_rx_list()
  65.  
  66. prevGadget = CreateGadget(LISTVIEW_KIND,prevGadget,newgadx,
  67.                          ,GTLV_Labels, rxList,
  68.                          ,TAG_DONE,0)
  69.  
  70. /****************************/
  71.  
  72.  
  73. call FreeThis(newgadx)  /* NewGadget-Struktur Speicher freigeben */
  74.  
  75.  
  76. window = open_window()
  77. if window = null() then
  78. do
  79.    REQUESTNOTIFY "Requester konnte nicht geöffnet werden.."
  80.    exit(10)
  81. end
  82.  
  83. OPTIONS FAILAT 6     /* ignore warnings */
  84.  
  85. SIGNAL ON SYNTAX     /* ensure clean exit */
  86.  
  87. exitme = 0
  88. do while exitme = 0
  89.  
  90.    x = waitpkt(portname)
  91.    do forever 
  92.       msg = getpkt(portname)
  93.       if msg = '0000 0000'x
  94.          then leave
  95.  
  96.       msgclass  = getarg(msg,0)
  97.       msgcode  = getarg(msg,1)
  98.       msggadadr= getarg(msg,8)
  99.       msggadid  = getarg(msg,9)
  100.       x = reply(msg,0)  
  101.  
  102.       select
  103.          when msgclass = CLOSEWINDOW then    /* Close-Gadget */
  104.          do
  105.             exitme = 1
  106.          end
  107.  
  108.          when msgclass = NEWSIZE then        /* Zoom-Gadget */
  109.          do
  110.             zoomed = (zoomed = 0)
  111.             if zoomed == 0 then              /* Gadgets refreshen */
  112.                call GT_RefreshWindow(window)
  113.          end
  114.  
  115.          when msgclass = GADGETUP then       /* Gadget-UP */
  116.          do
  117.             if msggadid = 1 then
  118.             do
  119.                dummy = msgcode + 1
  120.                fnode = rxList
  121.                do x = 1 to dummy
  122.                    fnode = next(fnode)
  123.                end
  124.  
  125.                theCmd = GETVALUE(fnode,10,4,'s')   /* F-Taste rausschneiden */
  126.                cpos   = pos(':',theCmd)
  127.                if cpos ~= 0 then
  128.                     theCmd = delstr(theCmd, 1, cpos)
  129.  
  130.                cpos = pos('%s',theCmd)  /* ZP-Port anhängen */
  131.                if cpos ~= 0 then
  132.                do
  133.                        theCmd = delstr(theCmd, cpos)
  134.                     theCmd = theCmd || zpPort
  135.                end
  136.  
  137.                address command theCmd
  138.             end
  139.          end
  140.  
  141.          otherwise
  142.            nop
  143.       end
  144.    end
  145. end
  146.  
  147.  
  148. /**********************************/
  149.  
  150. SYNTAX:
  151.  
  152. dummy = close_window()
  153.  
  154. call FreeVisualInfo(scrvinfo)
  155.  
  156. call FREE_EXEC_LIST(rxList)
  157.  
  158. exit(0)
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168. /*****************************************************************/
  169.  
  170. open_window:
  171. wintitle = "ZP's little helper"
  172. winidcmp = CLOSEWINDOW+NEWSIZE+LISTVIEWIDCMP
  173. winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+ACTIVATE
  174.  
  175. portname = "ZPOINT_HELP"
  176.  
  177. p = openport(portname)
  178.  
  179. myTitle  = 0
  180. tagList  = 0
  181. window   = 0
  182. zoomed   = 0
  183. if build_zoom_array() | build_window_name() then
  184. do
  185.    tagList = AllocateTagItems(13)
  186.    if tagList ~= null() then
  187.    do
  188.       call SetTagSlot(tagList,0,WA_LEFT,'n',0)
  189.  
  190.       call SetTagSlot(tagList,1,WA_TOP,'n',0)
  191.  
  192.       call SetTagSlot(tagList,2,WA_WIDTH,'n',640)
  193.  
  194.       call SetTagSlot(tagList,3,WA_HEIGHT,'n',200)
  195.  
  196.       call SetTagSlot(tagList,4,WA_DRAGBAR,'n',1) 
  197.  
  198.       call SetTagSlot(tagList,5,WA_CLOSEGADGET,'n',1) 
  199.  
  200.       call SetTagSlot(tagList,6,WA_ACTIVATE,'n',1) 
  201.  
  202.       call SetTagSlot(tagList,7,WA_TITLE,'p',myTitle)
  203.  
  204.       call SetTagSlot(tagList,8,WA_FLAGS,'n',winflags)
  205.  
  206.       call SetTagSlot(tagList,9,WA_ZOOM,'p',zoomArray)
  207.  
  208.       call SetTagSlot(tagList,10,WA_IDCMP,'n',winidcmp)
  209.  
  210.       call SetTagSlot(tagList,11,WA_CUSTOMSCREEN,'p',screen)
  211.  
  212.       call SetTagSlot(tagList,12,TAG_DONE,'n',0)
  213.  
  214.       window = OpenWindowTagList(portname,null(),tagList)
  215.       if window ~= null() then
  216.       do
  217.         call AddGList(window, conxgad, -1, -1, null());
  218.         call RefreshGList(conxgad, window, null(), -1);
  219.          call GT_RefreshWindow(window)
  220.       end
  221.    end
  222. end
  223.  
  224. call UnlockPubScreen(null(),screen)
  225.  
  226. return(window)
  227.  
  228.  
  229.  
  230. close_window:
  231. if conxgad ~= null() then
  232. do
  233.    if window ~= null() then
  234.       call RemoveGList(window, conxgad, -1)
  235.  
  236.    call FreeGadgets(conxgad)
  237.    drop conxgad
  238. end
  239.  
  240. if glist ~= null() then
  241. do
  242.    call FreeVec(glist)
  243.    drop glist
  244. end
  245.  
  246. if window ~= null() then
  247. do
  248.    call CloseWindow(window)
  249.    drop window
  250. end
  251.  
  252. if tagList ~= null() then
  253. do
  254.    call FreeTagItems(tagList)
  255.    drop tagList
  256. end
  257.  
  258. if myTitle ~= null() then
  259. do
  260.    call FreeVec(myTitle)
  261.    drop myTitle
  262. end
  263.  
  264. if zoomArray ~= null() then
  265. do
  266.    call FreeVec(zoomArray)
  267.    drop zoomArray
  268. end
  269.  
  270. return(0)
  271.  
  272. /*****************************************************************/
  273.  
  274. build_rx_list:
  275. mylist = AllocMem(14,MEMF_CLEAR)  /* our list structure  */
  276.                                   /* always use ALLOCMEM */
  277.                                   /* so it can be freed  */
  278.                                   /* properly.           */
  279.  
  280. call NewList(mylist)
  281.  
  282. file = 'T:RexxHelp-' || zpPort
  283. listformat = 'List > ' || file || ' ZP:Rexx/#?.zprx LFORMAT "%n >NIL ' || zpPort '"'
  284.  
  285. ADDRESS COMMAND listformat
  286.  
  287. if ~open('infile',file,read) then 
  288. do
  289.    REQUESTNOTIFY "Directory kann nicht gelesen werden.."
  290.    exit(0)
  291. end
  292.  
  293. instring = ''
  294. do forever
  295.    instring=readln('infile')
  296.    if eof('infile') then 
  297.       leave
  298.    dummy = ADD_LIST_NODE(mylist,instring)
  299. end
  300.  
  301. dummy = close('infile')
  302.  
  303. ADDRESS COMMAND Delete QUIET 'T:RexxHelp-' || zpPort
  304.  
  305. return mylist
  306.  
  307. /*****************************************************************/
  308.  
  309. build_zoom_array:
  310. zoomArray = AllocVec(16,MEMF_CLEAR)
  311. if zoomArray ~= null() then
  312. do
  313.    call export(zoomArray,'019f'x || '0011'x || '00e0'x || '000d'x)
  314.    return(1)
  315. end
  316. return(0)
  317.  
  318. /*****************************************************************/
  319.  
  320. build_window_name:
  321. myTitle = AllocVec(length(wintitle)+1,MEMF_CLEAR)
  322. if myTitle ~= null() then
  323. do
  324.    call export(myTitle,wintitle)
  325.    return(1)
  326. end
  327. return(0)
  328.  
  329. /*****************************************************************/
  330.